package com.quasar.hpatient.presenter;

import com.quasar.hpatient.model.httpmodel.AnotherResult;
import com.quasar.hpatient.model.httpmodel.DataStateResult;
import com.quasar.hpatient.model.medicalmodel.DoctorListBean;
import com.quasar.hpatient.model.requestmodel.RequestModel;
import com.quasar.hpatient.onInterface.AnotherResultListener;
import com.quasar.hpatient.onInterface.OnDoctorListener;
import com.quasar.hpatient.view.doctor.DoctorFindActivity;
/**
 * author : 许建宏
 * Date: 2017/10/21 0021
 * View:我的医生
 */

public class DoctorFindPresenter {

    private RequestModel requestModel;
    private OnDoctorListener onDoctorListener;

    public DoctorFindPresenter(OnDoctorListener onDoctorListener) {
        this.requestModel = new RequestModel();
        this.onDoctorListener = onDoctorListener;
    }

    //搜索医生
    public void PostMyDoctors(String provenceId, String cityId, String hospitalId, String departmentId, final String page,String rName){

        requestModel.PostDoctorFind(provenceId, cityId, hospitalId, departmentId, page,rName, new AnotherResultListener<AnotherResult<DoctorListBean>>() {
            @Override
            public void onSuccess(AnotherResult<DoctorListBean> data) {
                onDoctorListener.onSubmitSuccess(data);
            }

            @Override
            public void onError(String msg) {
                onDoctorListener.onError(msg);
            }

            @Override
            public void onRefreshUI() {
                onDoctorListener.onRefreshUI();
            }
        });
    }

    //获取热门医生
    public void StarDoctorList(String page){

        requestModel.StarDoctorList(page, new AnotherResultListener<AnotherResult<DoctorListBean>>() {
            @Override
            public void onSuccess(AnotherResult<DoctorListBean> data) {
                onDoctorListener.onDoctorListSuccess(data);
            }

            @Override
            public void onError(String msg) {
                onDoctorListener.onError(msg);
            }

            @Override
            public void onRefreshUI() {
                onDoctorListener.onRefreshUI();
            }
        });
    }

    //我的医生列表
    public void MyDoctorxData(String page){

        requestModel.MyDoctors(page, new AnotherResultListener<AnotherResult<DoctorListBean>>() {
            @Override
            public void onSuccess(AnotherResult<DoctorListBean> data) {
                onDoctorListener.onMyDoctorSuccess(data);
            }

            @Override
            public void onError(String msg) {
                onDoctorListener.onError(msg);
            }

            @Override
            public void onRefreshUI() {
                onDoctorListener.onRefreshUI();
            }
        });
    }

    //删除医生
    public void DeletePatientData(String doctorId){
        requestModel.DeletePatientData(doctorId, new AnotherResultListener<DataStateResult>() {
            @Override
            public void onSuccess(DataStateResult data) {
                onDoctorListener.onDeleteDoctorx(data);
            }

            @Override
            public void onError(String msg) {
                onDoctorListener.onError(msg);
            }

            @Override
            public void onRefreshUI() {
                onDoctorListener.onRefreshUI();
            }
        });
    }

    //申请医生
    public  void PostUpdateDoctorPatient(String doctorId){

        requestModel.UpdateDoctorPatientData(doctorId, new AnotherResultListener<DataStateResult>() {
            @Override
            public void onSuccess(DataStateResult data) {
                onDoctorListener.onApplyDoctorx(data);
            }

            @Override
            public void onError(String msg) {
                onDoctorListener.onError(msg);
            }

            @Override
            public void onRefreshUI() {
                onDoctorListener.onRefreshUI();
            }
        });
    }
}
